{% extends 'admin/index.html' %}


{% block con-title%}
    <div class="container-fluid am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                <div class="page-header-heading">
                    <span class="am-icon-home page-header-heading-icon">管理员添加</span>
            
        </div>
    </div>

{% endblock %}
{% block con-body %}
    <div class="row-content am-cf">
        <div class="row  am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-body am-fr">
                            <form action="{% url 'admin_authuseradd' %}" method='post' id="uploadForm" enctype="multipart/form-data" class="am-form tpl-form-line-form">
                                {% csrf_token %}
                                <div class="am-form-group">
                                    <label  for="user-name" class="am-u-sm-3 am-form-label">用户名</label>
                                    <div class="am-u-sm-9">
                                        <input name='username' required maxlength="50" type="text" class="tpl-form-input" id="user-name" placeholder="请输入您的用户名">
                                    </div>   
                                </div>
                                <div class="am-form-group">
                                    <label for="user-name" class="am-u-sm-3 am-form-label">密码</label>
                                    <div class="am-u-sm-9">
                                        <input name='password' required type="password" class="tpl-form-input" id="user-name" placeholder="请输入您的密码">
                                    </div>
                                </div>


                                <div class="am-form-group">
                                    <label for="user-name" class="am-u-sm-3 am-form-label">邮箱</label>
                                    <div class="am-u-sm-9">
                                        <input name='email' type="email" required class="tpl-form-input" id="user-name" placeholder="请输入您的邮箱">
                                    </div>
                                </div>

                                <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">
                                    所属组
                                </label>
                                <div class="am-u-sm-9 select">
                                   <div class="am-u-sm-5 ">
                                        <center><p>可选的组</p></center>
                                        <select class="one"  multiple="multiple">
                                         {% for v in glist %}
                                            <option value="{{ v.id }}">{{ v }}</option>
                                         {% endfor %}
                                         
                                        </select>
                                        <center>
                                            <br>
                                            <button type="button" class="btn-all am-btn am-btn-primary am-btn-xs">选择全部-> </button>
                                        </center>
                                   </div>
                                   <div class="am-u-sm-5">
                                        <center><p>已选择组</p></center>

                                        <select name="gs" class="two"  multiple="multiple">
                                         
                                        </select>

                                        <center>
                                            <br>
                                            <button type="button" class="btn-remove am-btn am-btn-danger am-btn-xs"> <- 移除权限 </button>
                                        </center>
                                   </div>
                                  
                                </div>

                             



                                
                                
                                 
                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <button  id='sb' class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button></div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script src="/static/admin/js/bootstrap-fileinput.js"></script>
<script type="text/javascript">
   $('.one option').dblclick(function(){
        $('.two').append($(this))
        $(this).attr('selected',false)
})
   $('.two').on('dblclick','option',function(){
        $('.one').append($(this))
        $(this).attr('selected',false)
   })
   $('.select .btn-all').click(function(){
        var s = $(this).parents('div').find('option')
        $('.two').append(s)
   })
   $('.select .btn-remove').click(function(){
        var s = $(this).parents('div').find('option')
        $('.one').append(s)
   })

  //绑定提交事件
    $('#sb').click(function(){

        $('.two option').prop('selected',true)
    }) 

</script>

{% endblock %}